# $Id: PKGBUILD 178840 2013-02-27 15:05:46Z thomas $
# Maintainer: Thomas Bächler <thomas@archlinux.org>

pkgname=watchdog
pkgver=5.13
pkgrel=1
pkgdesc="Watchdog daemon"
arch=(i686 x86_64)
url="http://sourceforge.net/projects/watchdog"
license=('GPL')
depends=('glibc')
backup=(etc/watchdog.conf)
source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz
        watchdog-5.12-fix-oom-in-wd_keepalive.patch
        watchdog.systemd)
md5sums=('153455f008f1cf8f65f6ad9586a21ff1'
         'c90c2686975b5254f82b3de683f1f442'
         'a835ae5cbdbb21c19a468dedb5d734e4')

build() {
  cd "${srcdir}"/${pkgname}-${pkgver}

  patch -p1 -i "${srcdir}"/watchdog-5.12-fix-oom-in-wd_keepalive.patch
  ./configure \
	--prefix=/usr \
	--mandir=/usr/share/man \
	--sysconfdir=/etc \
	--localstatedir=/var \
	--with-pidfile=/run/watchdog.pid \
	--with-ka_pidfile=/run/wd_keepalive.pid
  
  make
}

package() {
  cd "${srcdir}"/${pkgname}-${pkgver}
  make install DESTDIR="${pkgdir}"
  install -D -m644 "${srcdir}"/watchdog.systemd "${pkgdir}"/usr/lib/systemd/system/watchdog.service
}
